package com.panshi.controller;

import com.jfinal.aop.Before;
import com.jfinal.core.ActionKey;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;

import com.panshi.interceptor.GlobalInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;

/**
 * Created by tony on 2017/7/11.
 */
public class IndexController extends Controller {
    public static Logger LOG  = LoggerFactory.getLogger(IndexController.class);


    @ActionKey("/test")
    public void index() {

        String sql = Db.getSql("test.findUser");
        List<Record> records = Db.find(sql, 5);
        setAttr("data", records);

        records.get(0).getBigInteger("id");

        renderJson();
//        renderText("aaaa");
    }


    /**
     * 获取交易动态
     */
    @ActionKey("/trading-dynamics")
    @Before(GlobalInterceptor.class)
    public void trading_dynamics() {


        //获得当前可交易的品种信息
        List<Record> symbolChannels = Db.find("select *  from ot_symbol_channel  where type=1 ");

    }






}
